package com.wawei.seeds.comment;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;

import com.wawei.seeds.R;
import com.wawei.seeds.adapter.CommentListAdapter;
import com.wawei.seeds.model.UserImages;
import com.wawei.seeds.model.UserInfo;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by itachi on 15/7/16.
 */
public class CommontListActivity extends Activity {
    @InjectView(R.id.lv_main)ListView mListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_comment);
        ButterKnife.inject(this);

        mListView.addHeaderView(getHeadView());

        setData();
    }

    private void setData() {
        List<UserInfo> mList = new ArrayList<>();
        UserInfo mUserInfo = new UserInfo();
        mUserInfo.ui = new ArrayList<>();
        UserImages m = new UserImages();
        m.urls = "http://m1.img.srcdd.com/farm2/d/2011/0817/01/5A461954F44D8DC67A17838AA356FE4B_S64_64_64.JPEG";
        mUserInfo.ui.add(m);
        mList.add(mUserInfo);
        mUserInfo.comments = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            UserInfo info = new UserInfo();
            info.name = "宇智波鼬";
            info.comment = "哎哟，不错哦！" + i;
            mUserInfo.comments.add(info);
        }
        //---------------------------------------------
        UserInfo mUserInfo2 = new UserInfo();
        mUserInfo2.ui = new ArrayList<>();
        UserImages m2 = new UserImages();
        m2.urls = "http://m1.img.srcdd.com/farm2/d/2011/0817/01/5A461954F44D8DC67A17838AA356FE4B_S64_64_64.JPEG";
        mUserInfo2.ui.add(m2);
        UserImages m21 = new UserImages();
        m21.urls = "http://m1.img.srcdd.com/farm2/d/2011/0817/01/5A461954F44D8DC67A17838AA356FE4B_S64_64_64.JPEG";
        mUserInfo2.ui.add(m21);
        mList.add(mUserInfo2);
        mUserInfo2.comments = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            UserInfo info = new UserInfo();
            info.name = "宇智波鼬";
            info.comment = "哎哟，不错哦！" + i;
            mUserInfo2.comments.add(info);
        }

        CommentListAdapter mWeChatAdapter = new CommentListAdapter(this);
        mWeChatAdapter.setData(mList);
        mListView.setAdapter(mWeChatAdapter);
    }

    private View getHeadView() {
        View view = LayoutInflater.from(CommontListActivity.this).inflate(R.layout.friends_circle_head, null);
        return view;
    }
}
